<script setup lang='ts'>
import { ref } from 'vue';
import Child from './14_父传子中的子组件.vue';
const username = ref('苏苏')
const age = ref(18)

const changeInfo = () => {
    username.value = '红红'
    age.value++
}

const receiveFunc = (count: number) => {
    age.value = count
}
const receiveChildName = (name: string) => {
    username.value = name
}
const receiveAll = (count:number,name:string)=>{
    age.value = count,
    username.value = name
}
</script>

<template>
    <h1>父传子中的父组件</h1>
    <p>姓名：{{ username }}</p>
    <p>姓名：{{ age }}</p>
    <button @click="changeInfo">修改内容</button>
    <Child :name="username" :age="age" :func="receiveFunc" @update-age="receiveFunc"
     @update-name="receiveChildName"
     @update-all="receiveAll"
     >
    </Child>

</template>

<style scoped></style>